package com.changebitmapcolor;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;

public class FileUtils {

	
	public static void copyFileWithChannelMap(final File srcFile, final File desFile) throws IOException {
		
		FileChannel inputChannel= new FileInputStream(srcFile).getChannel();
		FileChannel outputChannel= new FileOutputStream(desFile).getChannel();
		MappedByteBuffer mappedByteBuffer= inputChannel.map(FileChannel.MapMode.READ_ONLY, 0, inputChannel.size());
		outputChannel.write(mappedByteBuffer);
		inputChannel.close();
		outputChannel.close();
		mappedByteBuffer.clear();
		mappedByteBuffer= null;
}
}
